package adsf.adminisadsf.gugedianzishichang.holder;

import android.view.View;

/**
 * Created by administrator on 17/5/13.
 */

public abstract class BaseHolder<T>
{
    private View mRootView;
    //在这里面里面做三步骤

    private T data;

    public BaseHolder()
    {
        mRootView = initView();
        //3.打一个标记
        mRootView.setTag(this);
    }

    //1.加载布局文件
    //2.初始化控件
    public abstract View initView();


    //返回当前item对象
    public View getmRootView()
    {
        return mRootView;
    }

    //设置item数据
    public void setData(T data)
    {
        this.data = data;
        //拿到数据后刷新数据
        refreshView(data);
    }

    //获取item数据
    public T getData()
    {
        return data;
    }


    public abstract void refreshView(T data);


}
